package cn.edu.fudan.bdke.ncov.qa.dao;

import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.Driver;
import org.neo4j.driver.GraphDatabase;
import org.neo4j.driver.Session;

/**
 * NEO4J Session
 *
 * @author xym
 * @since 1.0
 */
public class GraphDbSession {
    private static Driver driver;
    private static final String URI = "bolt://localhost:7687";
    private static final String USER_NAME = "neo4j";
    private static final String PASSWORD = "123456";

    private GraphDbSession() {
    }

    public static Session getSession() {
        if (driver == null) {
            driver = GraphDatabase.driver(URI, AuthTokens.basic(USER_NAME, PASSWORD));
        }
        return driver.session();
    }
}
